<?php

/**
 * categoria actions.
 *
 * @package    cronos-doctrine
 * @subpackage categoria
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class categoriaActions extends sfActions
{
  public function executeIndex(sfWebRequest $request)
  {
    $categoria = new Categoria();
    $this->categorias = $categoria->getCategoria();
    

  }

  public function executeShow(sfWebRequest $request)
  {
     
    if($request->getParameter('categoria')){
        $cate = new Categoria();
        $this->categoria = $cate->getCategoriaSlug($request->getParameter('id'));
    }else {
        $cate = new Categoria();
        $this->categoria = $cate->getCategoriaSlug($request->getParameter('id'));
    }
    
    
    $this->pager = new sfDoctrinePager('Producto', sfConfig::get('app_max_producto_x_categoria'));
    $this->pager->setQuery($this->categoria->getProductoActiveEshop());
    $this->pager->setPage($request->getParameter('page', 1));
    $this->pager->init();     
    //$this->getUser()->addCategoria($this->categoria);
  }
  
  public function executeShowServicio(sfWebRequest $request)
  {
    
    $producto = new Producto();
    
      
    $this->pager = new sfDoctrinePager('Producto', sfConfig::get('app_max_producto_x_categoria'));
    $this->pager->setQuery($producto->getTipoServicios());
    $this->pager->setPage($request->getParameter('page', 1));
    $this->pager->init();     
    
  }
}
